package com.joolun.weixin.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.joolun.common.corp.TenantContext;
import com.joolun.common.utils.DateUtils;
import com.joolun.system.domain.ScrmCustomerAcquisition;
import com.joolun.weixin.mapper.ScrmCustomerAcquisitionMapper;
import com.joolun.weixin.service.IScrmCustomerAcquisitionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 获客助手Service业务层处理
 * 
 * @author joolun
 * @date 2025-03-06
 */
@Service
public class ScrmCustomerAcquisitionServiceImpl extends  ServiceImpl<ScrmCustomerAcquisitionMapper, ScrmCustomerAcquisition> implements IScrmCustomerAcquisitionService
{
    @Autowired
    private ScrmCustomerAcquisitionMapper scrmCustomerAcquisitionMapper;

    /**
     * 查询获客助手
     * 
     * @param id 获客助手主键
     * @return 获客助手
     */
    @Override
    public ScrmCustomerAcquisition selectScrmCustomerAcquisitionById(Long id)
    {
        return scrmCustomerAcquisitionMapper.selectScrmCustomerAcquisitionById(id);
    }

    /**
     * 查询获客助手列表
     * 
     * @param scrmCustomerAcquisition 获客助手
     * @return 获客助手
     */
    @Override
    public List<ScrmCustomerAcquisition> selectScrmCustomerAcquisitionList(ScrmCustomerAcquisition scrmCustomerAcquisition)
    {
        // 添加主体id
        scrmCustomerAcquisition.setCorpId(TenantContext.getTenantId());
        return scrmCustomerAcquisitionMapper.selectScrmCustomerAcquisitionList(scrmCustomerAcquisition);
    }

    /**
     * 新增获客助手
     * 
     * @param scrmCustomerAcquisition 获客助手
     * @return 结果
     */
    @Override
    public int insertScrmCustomerAcquisition(ScrmCustomerAcquisition scrmCustomerAcquisition)
    {
        // 添加主体id
        scrmCustomerAcquisition.setCorpId(TenantContext.getTenantId());
        scrmCustomerAcquisition.setCreateTime(DateUtils.getNowDate());
        return scrmCustomerAcquisitionMapper.insertScrmCustomerAcquisition(scrmCustomerAcquisition);
    }

    /**
     * 修改获客助手
     * 
     * @param scrmCustomerAcquisition 获客助手
     * @return 结果
     */
    @Override
    public int updateScrmCustomerAcquisition(ScrmCustomerAcquisition scrmCustomerAcquisition)
    {
        scrmCustomerAcquisition.setUpdateTime(DateUtils.getNowDate());
        return scrmCustomerAcquisitionMapper.updateScrmCustomerAcquisition(scrmCustomerAcquisition);
    }

    /**
     * 批量删除获客助手
     * 
     * @param ids 需要删除的获客助手主键
     * @return 结果
     */
    @Override
    public int deleteScrmCustomerAcquisitionByIds(Long[] ids)
    {
        return scrmCustomerAcquisitionMapper.deleteScrmCustomerAcquisitionByIds(ids);
    }

    /**
     * 删除获客助手信息
     * 
     * @param id 获客助手主键
     * @return 结果
     */
    @Override
    public int deleteScrmCustomerAcquisitionById(Long id)
    {
        return scrmCustomerAcquisitionMapper.deleteScrmCustomerAcquisitionById(id);
    }
}
